WPS Office.apk(点击下载) / jca.java


package defpackage;

import android.app.Activity;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ListAdapter;
import android.widget.RelativeLayout;
import cn.wps.moffice.common.beans.CommonErrorPage;
import cn.wps.moffice.common.beans.GridViewWithHeaderAndFooter;
import cn.wps.moffice.picstore.ext.PicItem;
import cn.wps.moffice.picstore.ext.category.PicStoreCategory;
import cn.wps.moffice_eng.R;
import com.mopub.mobileads.VastIconXmlManager;
import defpackage.jbj;
import java.util.ArrayList;
import java.util.List;

/* renamed from: jca  reason: default package */
public final class jca extends fyq implements GridViewWithHeaderAndFooter.e, jbj.a {
    protected View cAU;
    public cuc cAj;
    protected CommonErrorPage fwR;
    private ArrayList<PicStoreCategory.Category> krC = new ArrayList<>();
    protected jbz ktp;
    GridViewWithHeaderAndFooter ktq;
    boolean ktr = false;
    private boolean kts = false;
    boolean ktt = false;
    View ktu;
    View ktv;
    private View lu;
    private GridView mCategoryView;
    private View mRootView;

    public jca(Activity activity) {
        super(activity);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void e(BaseAdapter baseAdapter) {
        if (baseAdapter != null && baseAdapter.getCount() == 0) {
            this.ktv.setVisibility(8);
            this.ktu.setVisibility(8);
            if (!lwd.hu(getApplicationContext())) {
                this.fwR.setVisibility(0);
                this.fwR.nR(R.string.documentmanager_cloudfile_no_network);
                this.fwR.nT(R.drawable.phone_public_no_network_icon);
            } else if (this.kts && this.ktr) {
                this.fwR.nR(R.string.website_load_fail_click_retry);
                this.fwR.nT(R.drawable.phone_public_websisite_load_fail_icon);
                this.fwR.setVisibility(0);
            }
        }
        if (this.kts) {
            this.ktu.setVisibility(8);
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void loadData() {
        this.kts = false;
        this.ktr = false;
        this.fwR.setVisibility(8);
        this.ktu.setVisibility(0);
        this.mActivity.getLoaderManager().restartLoader(0, null, 
        /*  JADX ERROR: Method code generation error
            jadx.core.utils.exceptions.CodegenException: Error generate insn: 0x0023: INVOKE  
              (wrap: android.app.LoaderManager : 0x0015: INVOKE  (r1v2 android.app.LoaderManager) = 
              (wrap: android.app.Activity : 0x0013: IGET  (r1v1 android.app.Activity) = (r5v0 'this' jca A[IMMUTABLE_TYPE, THIS]) jca.mActivity android.app.Activity)
             type: VIRTUAL call: android.app.Activity.getLoaderManager():android.app.LoaderManager)
              (0 int)
              (null android.os.Bundle)
              (wrap: jbj$1 : 0x0020: CONSTRUCTOR  (r3v0 jbj$1) = 
              (wrap: log<cn.wps.moffice.picstore.ext.category.PicStoreCategory> : 0x0019: INVOKE  (r0v3 log<cn.wps.moffice.picstore.ext.category.PicStoreCategory>) = 
              (wrap: android.app.Activity : 0x0011: IGET  (r0v2 android.app.Activity) = (r5v0 'this' jca A[IMMUTABLE_TYPE, THIS]) jca.mActivity android.app.Activity)
             type: STATIC call: jbj.fE(android.content.Context):log)
              (r5v0 'this' jca A[IMMUTABLE_TYPE, THIS])
             call: jbj.1.<init>(log, jbj$a):void type: CONSTRUCTOR)
             type: VIRTUAL call: android.app.LoaderManager.restartLoader(int, android.os.Bundle, android.app.LoaderManager$LoaderCallbacks):android.content.Loader in method: jca.loadData():void, file: classes12.dex
            	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:255)
            	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:217)
            	at jadx.core.codegen.RegionGen.makeSimpleBlock(RegionGen.java:110)
            	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:56)
            	at jadx.core.codegen.RegionGen.makeSimpleRegion(RegionGen.java:93)
            	at jadx.core.codegen.RegionGen.makeRegion(RegionGen.java:59)
            	at jadx.core.codegen.MethodGen.addRegionInsns(MethodGen.java:244)
            	at jadx.core.codegen.MethodGen.addInstructions(MethodGen.java:237)
            	at jadx.core.codegen.ClassGen.addMethodCode(ClassGen.java:342)
            	at jadx.core.codegen.ClassGen.addMethod(ClassGen.java:295)
            	at jadx.core.codegen.ClassGen.lambda$addInnerClsAndMethods$2(ClassGen.java:264)
            	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
            	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
            	at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395)
            	at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258)
            Caused by: jadx.core.utils.exceptions.CodegenException: Error generate insn: 0x0020: CONSTRUCTOR  (r3v0 jbj$1) = 
              (wrap: log<cn.wps.moffice.picstore.ext.category.PicStoreCategory> : 0x0019: INVOKE  (r0v3 log<cn.wps.moffice.picstore.ext.category.PicStoreCategory>) = 
              (wrap: android.app.Activity : 0x0011: IGET  (r0v2 android.app.Activity) = (r5v0 'this' jca A[IMMUTABLE_TYPE, THIS]) jca.mActivity android.app.Activity)
             type: STATIC call: jbj.fE(android.content.Context):log)
              (r5v0 'this' jca A[IMMUTABLE_TYPE, THIS])
             call: jbj.1.<init>(log, jbj$a):void type: CONSTRUCTOR in method: jca.loadData():void, file: classes12.dex
            	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:255)
            	at jadx.core.codegen.InsnGen.addWrappedArg(InsnGen.java:119)
            	at jadx.core.codegen.InsnGen.addArg(InsnGen.java:103)
            	at jadx.core.codegen.InsnGen.generateMethodArguments(InsnGen.java:806)
            	at jadx.core.codegen.InsnGen.makeInvoke(InsnGen.java:746)
            	at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:367)
            	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:249)
            	... 14 more
            Caused by: jadx.core.utils.exceptions.JadxRuntimeException: Expected class to be processed at this point, class: jbj, state: GENERATED_AND_UNLOADED
            	at jadx.core.dex.nodes.ClassNode.ensureProcessed(ClassNode.java:215)
            	at jadx.core.codegen.InsnGen.makeConstructor(InsnGen.java:630)
            	at jadx.core.codegen.InsnGen.makeInsnBody(InsnGen.java:363)
            	at jadx.core.codegen.InsnGen.makeInsn(InsnGen.java:230)
            	... 20 more
            */
        /*
            this = this;
            r4 = 0
            r5.kts = r4
            r5.ktr = r4
            cn.wps.moffice.common.beans.CommonErrorPage r0 = r5.fwR
            r1 = 8
            r0.setVisibility(r1)
            android.view.View r0 = r5.ktu
            r0.setVisibility(r4)
            android.app.Activity r0 = r5.mActivity
            android.app.Activity r1 = r5.mActivity
            android.app.LoaderManager r1 = r1.getLoaderManager()
            log r0 = defpackage.jbj.fE(r0)
            r2 = 0
            jbj$1 r3 = new jbj$1
            r3.<init>(r0, r5)
            r1.restartLoader(r4, r2, r3)
            r5.auX()
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.jca.loadData():void");
    }

    @Override // defpackage.jbj.a
    public final void a(PicStoreCategory picStoreCategory) {
        if (picStoreCategory == null || picStoreCategory.krE == null || picStoreCategory.krE.size() <= 0) {
            this.kts = true;
            this.mCategoryView.setVisibility(8);
            e(this.ktp);
        } else {
            this.mCategoryView.setVisibility(0);
            this.ktu.setVisibility(0);
            this.krC.clear();
            ArrayList<PicStoreCategory.Category> arrayList = this.krC;
            List<PicStoreCategory.Category> list = picStoreCategory.krE;
            ArrayList arrayList2 = new ArrayList();
            for (PicStoreCategory.Category category : list) {
                if (category != null) {
                    if (!TextUtils.isEmpty(category.name)) {
                        arrayList2.add(category);
                    }
                }
            }
            arrayList.addAll(arrayList2);
        }
        ArrayList<PicStoreCategory.Category> arrayList3 = this.krC;
        if (arrayList3 == null || arrayList3.size() <= 0) {
            this.mCategoryView.setVisibility(8);
        } else {
            this.mCategoryView.setVisibility(0);
            jbd jbd = new jbd(this.mActivity);
            jbd.clear();
            jbd.krC.clear();
            jbd.krC.addAll(arrayList3);
            if (arrayList3 != null) {
                ArrayList arrayList4 = new ArrayList();
                if (arrayList3.size() <= 4 || arrayList3.size() == 8) {
                    arrayList4.addAll(arrayList3);
                } else if (arrayList3.size() < 8) {
                    arrayList4.addAll(arrayList3.subList(0, 3));
                    arrayList4.add(jbd.cIu());
                } else {
                    arrayList4.addAll(arrayList3.subList(0, 7));
                    arrayList4.add(jbd.cIu());
                }
                jbd.addAll(arrayList4);
            }
            this.mCategoryView.setAdapter((ListAdapter) jbd);
        }
        View findViewById = this.mRootView.findViewById(R.id.grid_view_container);
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) findViewById.getLayoutParams();
        layoutParams.setMargins(0, 0, 0, 0);
        findViewById.setLayoutParams(layoutParams);
    }

    @Override // cn.wps.moffice.common.beans.GridViewWithHeaderAndFooter.e
    public final void auX() {
        if (this.ktq.cSA.size() == 0 && this.cAU.getVisibility() == 8) {
            this.ktq.a(LayoutInflater.from(this.mActivity).inflate(R.layout.listview_loading_view, (ViewGroup) null), this);
            this.ktq.setHasMoreItems(true);
        }
        this.ktq.setIsLoading(true);
        new jbi().a(new jbg<jbl>(getActivity().getLoaderManager()) {
            /* class defpackage.jca.AnonymousClass4 */

            @Override // defpackage.jbg
            public final void a(jbh<jbl> jbh) {
                boolean z = true;
                jca.this.cAU.setVisibility(8);
                if (jbh.data == null || jbh.data.items == null) {
                    lvg.d(jca.this.mActivity, R.string.pic_store_no_more_rec, 0);
                    return;
                }
                int size = jbh.data.items.size();
                if (size == 0 && jca.this.ktp.getCount() == 0) {
                    lvg.d(jca.this.mActivity, R.string.pic_store_empty_list, 0);
                }
                if (size >= jaw.kqJ || jca.this.ktp.getCount() != 0) {
                    jca.this.ktv.setVisibility(0);
                    jca.this.ktu.setVisibility(0);
                    boolean z2 = jca.this.ktp.getCount() + size >= jaw.kqI;
                    boolean z3 = jbh.data.krV - size > jca.this.ktp.getCount();
                    if (z2) {
                        int count = (jca.this.ktp.getCount() + size) - jaw.kqI;
                        for (int i = size - 1; i >= size - count; i--) {
                            jbh.data.items.remove(i);
                        }
                    }
                    GridViewWithHeaderAndFooter gridViewWithHeaderAndFooter = jca.this.ktq;
                    if (!z3 || z2) {
                        z = false;
                    }
                    gridViewWithHeaderAndFooter.setHasMoreItems(z);
                    jca.this.ktp.cY(jbh.data.items);
                    return;
                }
                jca.this.ktr = true;
                jca.this.ktv.setVisibility(8);
                if (jca.this.mActivity != null) {
                    jca.this.e((jca) jca.this.ktp);
                }
            }

            @Override // defpackage.jbg
            public final void sE(String str) {
                jca.this.ktq.setHasMoreItems(false);
                jca.this.cAU.setVisibility(8);
                jca.this.ktr = true;
                if (!jca.this.ktt) {
                    jca.this.ktt = true;
                    lvg.a(jca.this.getActivity(), str, 0);
                }
                if (jca.this.mActivity != null) {
                    jca.this.e((jca) jca.this.ktp);
                }
            }
        }, "https://docer.wps.cn/v3.php/api/android/mb/picture/rec_data", true, "mb_app", new StringBuilder().append(jaw.kqF).toString(), VastIconXmlManager.OFFSET, new StringBuilder().append(this.ktp.getCount()).toString(), "limit", "10");
    }

    @Override // cn.wps.moffice.common.beans.GridViewWithHeaderAndFooter.e
    public final void ayM() {
    }

    public final void bRM() {
        this.ktp.a(this.ktq);
    }

    public final void bRN() {
        this.ktp.a(this.ktq);
    }

    @Override // defpackage.fys, defpackage.fyq
    public final View getMainView() {
        if (this.mRootView == null) {
            this.mRootView = LayoutInflater.from(this.mActivity).inflate(R.layout.activity_pic_store_home, (ViewGroup) null);
            this.ktq = (GridViewWithHeaderAndFooter) this.mRootView.findViewById(R.id.mGvPopRecommendList);
            this.cAU = this.mRootView.findViewById(R.id.loading_view);
            this.fwR = (CommonErrorPage) this.mRootView.findViewById(R.id.docer_template_specify_rec_item_nonetwork_container);
            this.fwR.a(new View.OnClickListener() {
                /* class defpackage.jca.AnonymousClass1 */

                public final void onClick(View view) {
                    jca.this.loadData();
                    jca.this.fwR.setVisibility(8);
                }
            });
            jbb.cIo().a(new jba() {
                /* class defpackage.jca.AnonymousClass2 */

                @Override // defpackage.jba
                public final void sM(boolean z) {
                }
            });
            this.lu = LayoutInflater.from(this.mActivity).inflate(R.layout.pic_store_home_header, (ViewGroup) null);
            this.mCategoryView = (GridView) this.lu.findViewById(R.id.category_grid_view);
            this.ktv = this.lu.findViewById(R.id.mTvPicStoreHotRec);
            this.ktu = this.lu.findViewById(R.id.mVCategoryDivider);
            this.ktp = new jbz();
            this.ktq.a(LayoutInflater.from(this.mActivity).inflate(R.layout.listview_loading_view, (ViewGroup) null), this);
            this.ktq.addHeaderView(this.lu, null, true);
            this.ktq.setAdapter((ListAdapter) this.ktp);
            this.ktp.a(this.ktq);
            this.ktq.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                /* class defpackage.jca.AnonymousClass3 */

                @Override // android.widget.AdapterView.OnItemClickListener
                public final void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
                    PicItem picItem;
                    if (jbc.dG(jca.this.mActivity) && (picItem = (PicItem) jca.this.ktp.getItem(i)) != null) {
                        jav.a(jca.this.mActivity, picItem);
                        dwp.at("picmall_recommend_photo_click", String.valueOf(i));
                    }
                }
            });
            if (this.mActivity.getResources().getConfiguration().orientation == 1) {
                bRN();
            } else {
                bRM();
            }
            this.cAj = new cuc(this.mRootView, "andriod_docervip_picmall_tip", jaw.mPosition);
            loadData();
        }
        return this.mRootView;
    }

    @Override // defpackage.fyq
    public final int getViewTitleResId() {
        return R.string.pic_store;
    }
}